//#pragma comment(linker,"/STACK:16777216") /*16Mb*/
//#pragma comment(linker,"/STACK:33554432") /*32Mb*/
#define _CRT_SECURE_NO_DEPRECATE
#include<iostream>
#include<numeric>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<memory>
#include<string>
#include<vector>
#include<cctype>
#include<list>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
using namespace std;

typedef unsigned long long      ui64;
typedef long long               i64;
typedef	vector<int>             VI;
typedef	vector<bool>            VB;
typedef	vector<VI>              VVI;
typedef	vector<string>          VS;
typedef	pair<int,int>           PII;
typedef map<string,int>         MSI;
typedef set<int>                SI;
typedef set<string>             SS;
typedef map<int,int>            MII;
typedef	pair<double,double>     PDD;

#define PB                      push_back
#define MP                      make_pair
#define X                       first
#define Y                       second
#define FOR(i, a, b)            for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b)           for(int i = (a) - 1; i >= (b); --i)
#define CLEAR(a, b)             memset(a, b, sizeof(a))
#define SZ(a)                   int((a).size())
#define ALL(a)                  (a).begin(), (a).end()
#define RALL(a)                 (a).rbegin(), (a).rend()
#define INF                     (2000000000)

vector<int> z_function (string s) {
	int n = (int) s.length();
	vector<int> z (n);
	for (int i=1, l=0, r=0; i<n; ++i) {
		if (i <= r)
			z[i] = min (r-i+1, z[i-l]);
		while (i+z[i] < n && s[z[i]] == s[i+z[i]])
			++z[i];
		if (i+z[i]-1 > r)
			l = i,  r = i+z[i]-1;
	}
	return z;
}

int main()
{
	string s1,s2;
	cin >> s1 >> s2;
	//s1 = "abracadabra";
	//s2 = "abrabracada";
	VI p = z_function(s1+"#"+s2);
	VI v(SZ(s2));
	FOR(i,0,SZ(s2)) {
		v[i] = p[SZ(s1)+i+1];
	}
	int last = SZ(s2)-1;
	int n = SZ(s2);
	VI breaks;
	while(last>=0) {
		bool ch = false;
		FOR(i,0,last+1) {
			if( i+v[i] > last ) {
				ch = 1;
				breaks.push_back(i);
				last = i-1;
				break;
			}
		}
		if( !ch ) {
			cout << "Yes\n";
			return 0;
		}
	}
	reverse(ALL(breaks));
	int it = 0;
	cout << "No\n";
	FOR(i,0,n) {
		if(it<SZ(breaks) && breaks[it]==i) {
			if(i)
				cout << " ";
			it++;
		}
		cout << s2[i];
	}
	cout << endl;
    return 0;
}